package 代码记录.Bit48天集训;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

/**
 * @author zx
 * @create 2022-04-18 16:31
 */
public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] map = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ", "22233344455566677778889999"};
        while (sc.hasNext()) {
            int n = sc.nextInt();
            //用set保存结果,去重
            Set<String> set = new TreeSet<>();
            for (int i = 0; i < n; i ++ ) {
                StringBuilder sb = new StringBuilder();
                char[] arr = sc.nextLine().replace("-", "").toCharArray();
                for (int j = 0; j < arr.length; j ++ ) {
                    if(j == 3) {
                        sb.append("-");
                    }
                    if(arr[j] >= 'A' && arr[j] <= 'Z') {
                        sb.append(map[1].charAt(map[0].indexOf(arr[j])));
                    }else {
                        sb.append(arr[j]);
                    }
                }
                set.add(sb.toString());
            }
            for (String res : set){
                System.out.println(res);
            }
            System.out.println();
        }
    }
}





